package com.apusic.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.apusic.entity.Member;
import com.apusic.entity.TBaseDistrict;
import com.apusic.service.DistrictService;
import com.apusic.service.MemberService;
import com.apusic.util.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping(value = "/district")
public class DistrictController {
	
	@Autowired
	private DistrictService districtService;
	@Autowired
	private MemberService memberService;
	/**
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/district")
	@ResponseBody
	public String getDistrictList(HttpServletRequest request,
			HttpServletResponse response,TBaseDistrict district) {
		List<TBaseDistrict> list = districtService.getDistrictList(district);
		System.out.print("aaa");
		return JsonUtils.objectToJson(list);
	}
	
	/**
	 * 获取委办局
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/member")
	@ResponseBody
	public String getMemberList(HttpServletRequest request,
			HttpServletResponse response,Member member) {
		List<Member> list = memberService.selectByObj(member);
		return JsonUtils.objectToJson(list);
	}
}
